package com.hnust.controller.paper.paperManagement;

import com.google.gson.Gson;
import com.hnust.domain.*;
import com.hnust.fx.FXMLController;
import com.hnust.service.GradeResultService;
import com.hnust.service.StudentService;
import com.hnust.store.DataStore;
import com.hnust.store.PaperListDataStore;
import com.hnust.store.TestClassNameStore;
import com.hnust.util.PaperDataModel;
import com.jfoenix.controls.JFXComboBox;
import javafx.application.Platform;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.event.EventType;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.geometry.Side;
import javafx.scene.Node;
import javafx.scene.chart.*;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.stage.DirectoryChooser;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import org.springframework.beans.factory.annotation.Autowired;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.URL;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
import java.util.function.Consumer;

@FXMLController
public class PaperResultController implements Initializable {

    public static PaperDataModel model = new PaperDataModel();
    public static String paperId,testId; //从PaperList传来的试卷ID，考试ID

    @FXML
    public Label TestName1;

    @FXML
    public Label TestName2;

    @FXML
    public Label TestName3;

    @FXML
    public Label TestName4;

    @FXML
    public ScrollPane container;
    @FXML
    public AnchorPane contain;
    @FXML
    public JFXComboBox<Label> Compbox;
    @FXML
    public Button ExportGradeButton;
    @FXML
    public VBox pieChartBox;
    @FXML
    public VBox queBarCharBox;
    @FXML
    public TableView<GradeListData> GradeTableView;
    @FXML
    public VBox errorBarChartBox;
    @Autowired
    private GradeResultService gradeResultService;
    @Autowired
    private DataStore dataStore;
    @Autowired
    private PaperListDataStore paperListDataStore;

    @Autowired
    private TestClassNameStore testClassNameStore;

    private final ObservableList<GradeListData> data = FXCollections.observableArrayList();
    private final ObservableList<PieChart.Data> pieDatalist= FXCollections.observableArrayList();
    private final List<StudentScoreList> sslList=new ArrayList<>();
    @Override
    public void initialize(URL location, ResourceBundle resources) {

        String[] text=model.getText().split(" ");
        paperId=text[0];
        System.out.println("paperId"+paperId);
        testId=text[1];
        System.out.println("testId"+testId);
        paperListDataStore.setTest_id("123");//整合时删除

        listenChange();
        initializeCompbox();
        initPieChartBox(range);
        initBarChartSubjectCount(range);
        initTableView();
        initBarChartBox();
        initTestName();
    }
    public static void setText(String text) {
        model.setText(text);
    }
    public void initTestName(){
        gradeResultService.getTestName(new Callback<Result<String>>() {
            @Override
            public void onResponse(Call<Result<String>> call, Response<Result<String>> response) {
                Result<String> body = response.body();
                String data = body.getData();
                TestName1.setText(data);
//                TestName1.setText("2020级操作系统期末考试");
                TestName2.setText(data+"成绩分析 单位：%");
                TestName3.setText(data+"各题型平均得分率 单位：%");
                TestName4.setText(data+"各错题人数统计  单位：人");
            }
            @Override
            public void onFailure(Call<Result<String>> call, Throwable throwable) {
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        Alert alert = new Alert(Alert.AlertType.ERROR, "请求失败，请检查网络设置！");
                        alert.showAndWait();
                    }
                });
            }
        }, "146336");
    }
    public void listenChange(){
        //通过监听最外层容器的宽度，来改变内层Anchor的宽度
        container.widthProperty().addListener(new ChangeListener<Number>() {
            @Override
            public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
                contain.setPrefWidth((double)newValue-2);
            }
        });
        //通过监听最外层容器的高度，来改变内层Anchor的高度
        container.heightProperty().addListener(new ChangeListener<Number>() {
            @Override
            public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
                contain.setPrefHeight((double)newValue-2);
            }
        });
    }
    public void initTableView(){
        data.add(new GradeListData("1","1905060118","MisY","大数据一班","100","100","20","29","38","90","优"));
        data.add(new GradeListData("2","1905060120","MisY","大数据二班","100","100","20","29","38","90","良"));
        TableColumn firstNameCol = new TableColumn("序号");
        firstNameCol.setMinWidth(120);
        firstNameCol.setCellValueFactory(
                new PropertyValueFactory<>("index"));

        TableColumn lastNameCol = new TableColumn("学号");
        lastNameCol.setMinWidth(160);
        lastNameCol.setCellValueFactory(
                new PropertyValueFactory<>("studentId"));

        TableColumn studentName = new TableColumn("姓名");
        studentName.setMinWidth(140);
        studentName.setCellValueFactory(
                new PropertyValueFactory<>("studentName"));

        TableColumn className = new TableColumn("班级");
        className.setMinWidth(200);
        className.setCellValueFactory(
                new PropertyValueFactory<>("className"));

        TableColumn sum = new TableColumn("总分");
        sum.setMinWidth(120);
        sum.setCellValueFactory(
                new PropertyValueFactory<>("sum"));

        TableColumn rightRank = new TableColumn("正确率(%)");
        rightRank.setMinWidth(120);
        rightRank.setCellValueFactory(
                new PropertyValueFactory<>("rightRank"));

        TableColumn chooesQue = new TableColumn("选择题");
        chooesQue.setMinWidth(120);
        chooesQue.setCellValueFactory(
                new PropertyValueFactory<>("chooesQue"));

        TableColumn TianKongQue = new TableColumn("填空题");
        TianKongQue.setMinWidth(120);
        TianKongQue.setCellValueFactory(
                new PropertyValueFactory<>("TianKongQue"));

        TableColumn WenDaQue = new TableColumn("问答题");
        WenDaQue.setMinWidth(120);
        WenDaQue.setCellValueFactory(
                new PropertyValueFactory<>("WenDaQue"));

        TableColumn ZongHeQue = new TableColumn("综合题");
        ZongHeQue.setMinWidth(120);
        ZongHeQue.setCellValueFactory(
                new PropertyValueFactory<>("ZongHeQue"));

        TableColumn rank = new TableColumn("等级");
        rank.setMinWidth(120);
        rank.setCellValueFactory(
                new PropertyValueFactory<>("rank"));

        GradeTableView.setItems(data);
        GradeTableView.getColumns().addAll(firstNameCol, lastNameCol,studentName,className,sum,rightRank,chooesQue,TianKongQue,WenDaQue,ZongHeQue,rank);

    }
    Map<String ,String > ClassNameMap = new HashMap<>();  //保存Id与name的键值对
    static int[] rangSum = new int[4];
    static double[] range = new double[4];
    double[] sumRange= {0, 0, 0, 0};
    public void initializeCompbox(){
        gradeResultService.getClassName(new Callback<Result<List<ClassNameAndID>>>() {

            @Override
            public void onResponse(Call<Result<List<ClassNameAndID>>> call, Response<Result<List<ClassNameAndID>>> response) {
                Result<List<ClassNameAndID>> result= response.body();
                testClassNameStore.setClassNameList(result.getData());
//                ClassNameAndID c1=null;
//                c1.setID("1234");
//                c1.setClassName("232455");
//                List<ClassNameAndID> list = new ArrayList<>();
//                list.add(c1);
//                testClassNameStore.setClassNameList(list);
                ClassNameMap.clear();
//                Compbox.setPromptText("请选择班级");

                for(ClassNameAndID classNameAndID:result.getData()){
                    Compbox.getItems().add(new Label(classNameAndID.getClassName()));
                    ClassNameMap.put(classNameAndID.getClassName(),classNameAndID.getID());
                }

            }
            @Override
            public void onFailure(Call<Result<List<ClassNameAndID>>> call, Throwable throwable) {
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        Alert alert = new Alert(Alert.AlertType.ERROR, "请求失败，请检查网络设置！");
                        alert.showAndWait();
                    }
                });
            }
        },testId);

        Compbox.setPromptText("请选择班级");
        Compbox.setValue(new Label(" "));
        Compbox.valueProperty().addListener(new ChangeListener<Label>() {
            @Override
            public void changed(ObservableValue<? extends Label> observable, Label oldValue, Label newValue) {
                System.out.println("old"+oldValue.getText());
                System.out.println("new"+ClassNameMap.get(newValue.getText()));

                for(int i = 0;i<4;i++){
                    rangSum[i] =0;//评优等级
                    range[i] = 0;//评优条形图
                }
                for(int i = 0;i<28;i++){
                    cuoTiPerson[i] = 0;//错题人数
                }
                data.clear(); //情况表格数据
                try {
                    gradeResultService.getClassGrade(new Callback<Result<List<StudentGradReport>>>() {
                        @Override
                        public void onResponse(Call<Result<List<StudentGradReport>>> call, Response<Result<List<StudentGradReport>>> response) {
                            Result<List<StudentGradReport>> result= response.body();
                            List<StudentGradReport> datalist = result.getData();
                            if(datalist!=null){
                                int[] sums = new int[5];//选择题分 填空题 问答题 综合题 总分
                                for(StudentGradReport studentGradReport:datalist){
                                    for (int i=0;i<5;i++)
                                        sums[i]=0;
                                    int i = 0;
                                    int cuoTi = 0;
                                    String sore = studentGradReport.getSore();
                                    if(sore == null){
                                        continue;
                                    }
                                    System.out.println(sore);
                                    String[] split = sore.split("#");
                                    for(String s:split){
                                        String[] $s = s.split("￥");
                                        for(String ss:$s){
                                            if(Integer.parseInt(ss) == 0){
                                                cuoTiPerson[cuoTi]++;
                                            }
                                            if (Integer.parseInt(ss)>-1)
                                                sums[i]+=Integer.parseInt(ss);
                                            cuoTi++;
                                        }
                                        sums[4]+=sums[i];
                                        i++;
                                    }
                                    String rank = null;
                                    if(sums[4]>=90){
                                        rank = "优";
                                        rangSum[0]++;
                                    }else if(sums[4]>=80){
                                        rank = "良";
                                        rangSum[1]++;
                                    }else if(sums[4]>=60){
                                        rank = "中";
                                        rangSum[2]++;
                                    }else {
                                        rank = "不及格";
                                        rangSum[3]++;
                                    }
                                    String index = studentGradReport.getStuId().substring(studentGradReport.getStuId().length()-2);
                                    data.add(new GradeListData(index,studentGradReport.getStuId(),studentGradReport.getName(),newValue.getText(),String.valueOf(sums[4]),
                                            String.valueOf(sums[4]),String.valueOf(sums[0]),String.valueOf(sums[1]),String.valueOf(sums[2]),String.valueOf(sums[3]),rank));
                                    StudentScoreList ssl=new StudentScoreList(index,studentGradReport.getStuId(),studentGradReport.getName(),newValue.getText(),String.valueOf(sums[4]),
                                            String.valueOf(sums[4]),String.valueOf(sums[0]),String.valueOf(sums[1]),String.valueOf(sums[2]),String.valueOf(sums[3]),rank);
                                    sslList.add(ssl);
                                }
                                for(int i = 0;i<4&&datalist.size()!=0;i++){
                                    range[i] = (double)rangSum[i]/(double)datalist.size()*100;
//                                    sumRange[i]=sums[i]/(double)datalist.size()*100;
                                }
                            }
                            d1.setYValue(range[0]);   //向条形图添加数据
                            d2.setYValue(range[1]);   //向条形图添加数据
                            d3.setYValue(range[2]);   //向条形图添加数据
                            d4.setYValue(range[3]);   //向条形图添加数据
                            try{
                                pied1.setName("优秀 "+range[0]+"%");
                                pied1.setPieValue(range[0]);
                                pied2.setName("良好 "+range[1]+"%");
                                pied2.setPieValue(range[1]);
                                pied3.setName("中等 "+range[2]+"%");
                                pied3.setPieValue(range[2]);
                                pied4.setName("不及格 "+range[3]+"%");
                                pied4.setPieValue(range[3]);
                            }catch (Exception e){
                            }
                            data1.setYValue(cuoTiPerson[0]);
                            data2.setYValue(cuoTiPerson[1]);
                            data3.setYValue(cuoTiPerson[2]);
                            data4.setYValue(cuoTiPerson[3]);
                            data5.setYValue(cuoTiPerson[4]);
                            data6.setYValue(cuoTiPerson[5]);
                            data7.setYValue(cuoTiPerson[6]);
                            data8.setYValue(cuoTiPerson[7]);
                            data9.setYValue(cuoTiPerson[8]);
                            data10.setYValue(cuoTiPerson[9]);
                            data11.setYValue(cuoTiPerson[10]);
                            data12.setYValue(cuoTiPerson[11]);
                            data13.setYValue(cuoTiPerson[12]);
                            data14.setYValue(cuoTiPerson[13]);
                            data15.setYValue(cuoTiPerson[14]);
                            data16.setYValue(cuoTiPerson[15]);
                            data17.setYValue(cuoTiPerson[16]);
                            data18.setYValue(cuoTiPerson[17]);
                            data19.setYValue(cuoTiPerson[18]);
                            data20.setYValue(cuoTiPerson[19]);
                            data21.setYValue(cuoTiPerson[20]);
                            data22.setYValue(cuoTiPerson[21]);
                            data23.setYValue(cuoTiPerson[22]);
                            data24.setYValue(cuoTiPerson[23]);
                            data25.setYValue(cuoTiPerson[24]);
                            data26.setYValue(cuoTiPerson[25]);
                            data27.setYValue(cuoTiPerson[26]);
                            data28.setYValue(cuoTiPerson[27]);
                        }
                        @Override
                        public void onFailure(Call<Result<List<StudentGradReport>>> call, Throwable throwable) {
                            Platform.runLater(new Runnable() {
                                @Override
                                public void run() {
                                    Alert alert = new Alert(Alert.AlertType.ERROR, "请求失败，请检查网络设置！");
                                    alert.showAndWait();
                                }
                            });
                        }
                    },testId,ClassNameMap.get(newValue.getText()));
//                    ClassNameMap.get(newValue.getText())
                } catch (Exception e) {

                }
            }
        });
    }

    private PieChart.Data pied1=new PieChart.Data("优秀", 0);
    private PieChart.Data pied2=new PieChart.Data("良好", 0);
    private PieChart.Data pied3=new PieChart.Data("中等", 0);
    private PieChart.Data pied4=new PieChart.Data("不及格", 0);
    public  void initPieChartBox(double[] range){
        ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList();
        pieChartData.addAll(pied1,pied2,pied3,pied4);
        PieChart pieChart=new PieChart(pieChartData);
        pieChartBox.getChildren().add(pieChart);
    }

    private XYChart.Data<String,Double> d1 = new XYChart.Data("选择题",0.0);
    private XYChart.Data<String,Double> d2 = new XYChart.Data("填空题",0.0);
    private XYChart.Data<String,Double> d3 = new XYChart.Data("问答题",0.0);
    private XYChart.Data<String,Double> d4 = new XYChart.Data("综合题",0.0);

    public void initBarChartSubjectCount(double[] rangeArr){
        CategoryAxis xaxis  =new CategoryAxis();
        NumberAxis yaxis = new NumberAxis(0.00,100.00,10.00);
        BarChart<String,Double> bar = new BarChart(xaxis,yaxis);
        XYChart.Series<String,Double> series = new XYChart.Series<>();
        series.setName("得分率");
        series.getData().addAll(d1,d2,d3,d4);
        bar.getData().setAll(series);
        queBarCharBox.getChildren().add(bar);
    }
    private XYChart.Data data1 =  new XYChart.Data("1题",0);
    private XYChart.Data data2 =  new XYChart.Data("2题",0);
    private XYChart.Data data3 =  new XYChart.Data("3题",0);
    private XYChart.Data data4 =  new XYChart.Data("4题",0);
    private XYChart.Data data5 =  new XYChart.Data("5题",0);
    private XYChart.Data data6 =  new XYChart.Data("6题",0);
    private XYChart.Data data7 =  new XYChart.Data("7题",0);
    private XYChart.Data data8 =  new XYChart.Data("8题",0);
    private XYChart.Data data9 =  new XYChart.Data("9题",0);
    private XYChart.Data data10 = new XYChart.Data("10题",0);
    private XYChart.Data data11 = new XYChart.Data("11题",0);
    private XYChart.Data data12 = new XYChart.Data("12题",0);
    private XYChart.Data data13 = new XYChart.Data("13题",0);
    private XYChart.Data data14 = new XYChart.Data("14题",0);
    private XYChart.Data data15 = new XYChart.Data("15题",0);
    private XYChart.Data data16 = new XYChart.Data("16题",0);
    private XYChart.Data data17 = new XYChart.Data("17题",0);
    private XYChart.Data data18 = new XYChart.Data("18题",0);
    private XYChart.Data data19 = new XYChart.Data("19题",0);
    private XYChart.Data data20 = new XYChart.Data("20题",0);
    private XYChart.Data data21 = new XYChart.Data("21题",0);
    private XYChart.Data data22 = new XYChart.Data("22题",0);
    private XYChart.Data data23 = new XYChart.Data("23题",0);
    private XYChart.Data data24 = new XYChart.Data("24题",0);
    private XYChart.Data data25 = new XYChart.Data("25题",0);
    private XYChart.Data data26 = new XYChart.Data("26题",0);
    private XYChart.Data data27 = new XYChart.Data("27题",0);
    private XYChart.Data data28 = new XYChart.Data("28题",0);

    static int[] cuoTiPerson = new int[28];
    public void initBarChartBox(){
        CategoryAxis xaxis = new CategoryAxis();
        NumberAxis yaxis = new NumberAxis(0.00,40.00,5.00);
        BarChart<String,Double> bar = new BarChart(xaxis,yaxis);
        XYChart.Series<String,Double> series = new XYChart.Series<>();
        series.setName("人数");
        series.getData().addAll(data1,data2,data3,data4,data5,data6,data7,data8,data9,data10,data11,data12,data13,data14,data15,data16,data17,data18,data19,data20,data21,data22,data23,data24,data25,data26,data27,data28);
        bar.getData().add(series);
        errorBarChartBox.getChildren().add(bar);
    }
    //下载试卷
    public void download(){
        gradeResultService.getPaperDocx(new Callback<ResponseBody>() {
            @Override
            public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        InputStream in=response.body().byteStream();
                        FileOutputStream os=null;
                        try{
                            DirectoryChooser directoryChooser=new DirectoryChooser();
                            File file1 = directoryChooser.showDialog(null);
                            if(file1==null){
                                throw new Exception("空指针异常！");
                            }
                            String path = file1.getPath();//选择的文件夹路径
                            String name= UUID.randomUUID().toString().replaceAll("-","").substring(0,7)+"试卷";
                            os = new FileOutputStream(path+"\\"+name+".docx");
                            byte[] buffer = new byte[4 * 1024];
                            int read;
                            while ((read = in.read(buffer)) > 0) {
                                os.write(buffer, 0, read);
                            }
                        }catch (Exception e){

                        }finally {
                            try{
                                os.close();
                                in.close();
                            }catch (Exception e){

                            }
                        }
                    }
                });
            }
            @Override
            public void onFailure(Call<ResponseBody> call, Throwable t) {
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        Alert alert = new Alert(Alert.AlertType.ERROR, "请求失败，请检查网络设置！");
                        alert.showAndWait();
                    }
                });
            }
        },paperId);
    }
    //导出学生成绩单
    public void ExportGradeButton(){
//        System.out.println("何易于好帅啊<_>sslList:"+sslList);
        Gson gson = new Gson();
        String json = gson.toJson(sslList);
        RequestBody exportList= RequestBody.create(MediaType.parse("application/json; charset=utf-8"),json);
        gradeResultService.exportList(new Callback<ResponseBody>() {
            @Override
            public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        System.out.println("导出学生成绩单response.body().byteStream()"+response.body());
                        InputStream in=response.body().byteStream();
                        FileOutputStream os=null;
                        try{
                            System.out.println("开始执行导出");
                            DirectoryChooser directoryChooser=new DirectoryChooser();
                            File file1 = directoryChooser.showDialog(null);
                            if(file1==null){
                                throw new Exception("空指针异常！");
                            }
                            String path = file1.getPath();//选择的文件夹路径
                            String name= "学生成绩单";
                            os = new FileOutputStream(path+"\\"+name+".xls");
                            byte[] buffer = new byte[4 * 1024];
                            int read;
                            while ((read = in.read(buffer)) > 0) {
                                os.write(buffer, 0, read);
                            }
                            System.out.println("导出执行完毕！");
                        }catch (Exception e){

                        }finally {
                            try{
                                os.close();
                                in.close();
                            }catch (Exception e){

                            }
                        }
                    }
                });
            }
            @Override
            public void onFailure(Call<ResponseBody> call, Throwable t) {
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        Alert alert = new Alert(Alert.AlertType.ERROR, "请求失败，请检查网络设置！");
                        alert.showAndWait();
                    }
                });
            }
        },exportList);
    }

    public static class GradeListData {
        private final SimpleStringProperty index;
        private final SimpleStringProperty studentId;
        private final SimpleStringProperty studentName;//姓名
        private final SimpleStringProperty className;//班级
        private final SimpleStringProperty sum;//总分
        private final SimpleStringProperty rightRank;//正确率
        private final SimpleStringProperty chooesQue;//选择题
        private final SimpleStringProperty TianKongQue;//填空题
        private final SimpleStringProperty WenDaQue;//问答题
        private final SimpleStringProperty ZongHeQue;//综合题
        private final SimpleStringProperty rank;//等级

        private GradeListData(String index, String studentId,String studentName,String className,String sum,String rightRank,String chooesQue,String TianKongQue,String WenDaQue,String ZongHeQue,String rank) {
            this.index = new SimpleStringProperty(index);
            this.studentId = new SimpleStringProperty(studentId);
            this.studentName = new SimpleStringProperty(studentName);
            this.className = new SimpleStringProperty(className);
            this.sum = new SimpleStringProperty(sum);
            this.chooesQue = new SimpleStringProperty(chooesQue);
            this.TianKongQue = new SimpleStringProperty(TianKongQue);
            this.WenDaQue  = new SimpleStringProperty(WenDaQue);
            this.ZongHeQue = new SimpleStringProperty(ZongHeQue);
            this.rightRank = new SimpleStringProperty(rightRank);
            this.rank = new SimpleStringProperty(rank);
        }

        public String getIndex() {
            return index.get();
        }

        public SimpleStringProperty indexProperty() {
            return index;
        }

        public void setIndex(String index) {
            this.index.set(index);
        }

        public String getStudentId() {
            return studentId.get();
        }

        public SimpleStringProperty studentIdProperty() {
            return studentId;
        }

        public void setStudentId(String studentId) {
            this.studentId.set(studentId);
        }

        public String getStudentName() {
            return studentName.get();
        }

        public SimpleStringProperty studentNameProperty() {
            return studentName;
        }

        public void setStudentName(String studentName) {
            this.studentName.set(studentName);
        }

        public String getClassName() {
            return className.get();
        }

        public SimpleStringProperty classNameProperty() {
            return className;
        }

        public void setClassName(String className) {
            this.className.set(className);
        }

        public String getSum() {
            return sum.get();
        }

        public SimpleStringProperty sumProperty() {
            return sum;
        }

        public void setSum(String sum) {
            this.sum.set(sum);
        }

        public String getRightRank() {
            return rightRank.get();
        }

        public SimpleStringProperty rightRankProperty() {
            return rightRank;
        }

        public void setRightRank(String rightRank) {
            this.rightRank.set(rightRank);
        }

        public String getChooesQue() {
            return chooesQue.get();
        }

        public SimpleStringProperty chooesQueProperty() {
            return chooesQue;
        }

        public void setChooesQue(String chooesQue) {
            this.chooesQue.set(chooesQue);
        }

        public String getTianKongQue() {
            return TianKongQue.get();
        }

        public SimpleStringProperty tianKongQueProperty() {
            return TianKongQue;
        }

        public void setTianKongQue(String tianKongQue) {
            this.TianKongQue.set(tianKongQue);
        }

        public String getWenDaQue() {
            return WenDaQue.get();
        }

        public SimpleStringProperty wenDaQueProperty() {
            return WenDaQue;
        }

        public void setWenDaQue(String wenDaQue) {
            this.WenDaQue.set(wenDaQue);
        }

        public String getZongHeQue() {
            return ZongHeQue.get();
        }

        public SimpleStringProperty zongHeQueProperty() {
            return ZongHeQue;
        }

        public void setZongHeQue(String zongHeQue) {
            this.ZongHeQue.set(zongHeQue);
        }

        public String getRank() {
            return rank.get();
        }

        public SimpleStringProperty rankProperty() {
            return rank;
        }

        public void setRank(String rank) {
            this.rank.set(rank);
        }
    }
}
